import request from '../utils/request';

const HTTP = '/web'

// 首页物料列表（数据库直查）
export const getComputer = query => {
    return request({
        url: `${HTTP}/product/list`,
        method: 'get',
        params: query
    })
}

// 首页物料列表（ES索引）
export const getProductDate = query => {
    return request({
        url: `${HTTP}/product/searchDate`,
        method: 'get',
        params: query
    })
}
//添加购物车
export const add = query =>{
    return request({
        url: `${HTTP}/cart/add`,
        method: 'post',
        data: query
    })
}
//登录
export const Login = query => {
    return request({
        url: `${HTTP}/member/login`,
        method: 'post',
        data: query
    })
}
//注册
export const registerUser = query => {
    return request({
        url: `${HTTP}/member/register`,
        method: 'post',
        data: query
    })
}
//
export const cartDel = query => {
    return request({
        url: `${HTTP}/cart/del`,
        method: 'post',
        params: query
    })
}
export const getCar = query => {
    return request({
        url: `${HTTP}/cart/list`,
        method: 'get',
        params: query
    })
}
export const updateNum = query => {
    return request({
        url: `${HTTP}/cart/updateNum`,
        method: 'post',
        params : query
    })
}
export const updatePasswoer = query => {
    return request({
        url: `${HTTP}/member/updatePassword`,
        method: 'post',
        data: query
    })
}
export const makeOrder = query => {
    return request({
        url: `${HTTP}/order/makeOrder`,
        method: 'post',
        data: query
    })
}

// 物料详情
export const productDetail = query => {
    return request({
        url: `${HTTP}/product/productDetail`,
        method: 'post',
        data: query
    })
}